<?php
session_start();
require_once '../location.php';
require_once ROOT_PATH . 'library/IdCard/IdCardAuthentication.php';
require_once ROOT_PATH . 'library/IdCard/IdCardUser.php';

$id = new IdCardAuthentication();
try {
	$idCardUser = $id->getUser();
} catch (AuthenticationException $e) {
	header('Location: /user/id-card-failed');
}
$_SESSION['idCardUser'] = serialize($idCardUser);

if (isset($_GET['auth'])) {
	header('Location: /user/id-card-authentication');	
} else {
	header('Location: /user/id-card-login');
}
?>